package com.wnhz.work.yz.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.R;
import com.wnhz.work.yz.adapter.ChooseKindAdapter;
import com.wnhz.work.yz.bean.ChooseKindBean;
import com.wnhz.work.yz.view.NoScrollListView;

import java.util.ArrayList;
import java.util.List;

/**
 * ---选择种类
 */
public class ChooseKindActivity extends BaseActivity implements View.OnClickListener {
    private TextView title;
    private NoScrollListView my_listView;
    private List<ChooseKindBean> beanList = new ArrayList<>();
    private ChooseKindAdapter mAdapter;

    private String[] names = {"主体", "洗漱", "淋浴", "电器", "辅料"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_kind);

        initData();
        initView();
    }

    private void initData() {
        for (int i = 0; i < names.length; i++) {
            ChooseKindBean bean = new ChooseKindBean();
            bean.setName(names[i]);

            beanList.add(bean);
        }
    }

    private void initView() {
        title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("选择种类");
        findViewById(R.id.btn_main_left).setOnClickListener(this);

        my_listView = (NoScrollListView) findViewById(R.id.my_listView);
        mAdapter = new ChooseKindAdapter(this, beanList);
        my_listView.setAdapter(mAdapter);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;

            default:
                break;
        }
    }
}
